package client.core;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Date;
import java.sql.SQLException;

public class Rental {
	private int Id;
	private Date date_from;
	private Date date_to;
	private int carId;
	private int clientId;
	private Date date_returned;
	private double price;
	
	public int getId() {
		return Id;
	}
	public void setId(int id) {
		Id = id;
	}
	public Date getDateFrom() {
		return date_from;
	}
	public void setDateFrom(Date from) {
		this.date_from = from;
	}
	public Date getDateTo() {
		return date_to;
	}
	public void setDateTo(Date to) {
		this.date_to = to;
	}
	public int getCarId() {
		return carId;
	}
	public void setCarId(int carId) {
		this.carId = carId;
	}
	public int getClientId() {
		return clientId;
	}
	public void setClientId(int clientId) {
		this.clientId = clientId;
	}
	
	@Override
	public String toString() {
		Engine e;
		try {
			e = Engine.getInstance();
			Car car = e.getCarById(carId);
			return date_from + " - " + date_to + ", " + car.getProducer() + " " + car.getModel();
		} catch (SQLException | IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			return "Couldn't get car by id";
		}
	}
	public Date getDateReturned() {
		return date_returned;
	}
	public void setDateReturned(Date date_returned) {
		this.date_returned = date_returned;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	
}
